package iohuan_;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/5/4 9:11
 * @description:
 */
public class Copy_file_renew {

  public static void main(String[] args) {
    BufferedReader br=null;
    BufferedWriter bw=null;
    try {
      br = new BufferedReader(new FileReader("a.txt"));
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
    try {
      bw = new BufferedWriter(new FileWriter("C:\\echoo.txt"));
      String line=null;
      while ((line=br.readLine())!=null)
      {
        bw.write(line);
        bw.newLine();
      }


    } catch (IOException e) {
      System.out.println(e.getMessage());




    }
    finally {
      if(br!=null)
      {
        try {
          br.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      if(bw!=null)
      {
        try {
          bw.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }


  }




}
